package xpn.platform.modules.sys.worktransfer;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.config.Projection;
import xpn.platform.common.repository.XpnRepository;

@RepositoryRestResource(path = "work_transfer", excerptProjection = DefaultWorkTransferProjection.class)
public interface WorkTransferDAO extends XpnRepository<WorkTransfer, Long> {

}

/**
 * 缺省投影
 *
 * @author bobatkm
 *
 */
@Projection(name = "default", types = { WorkTransfer.class })
interface DefaultWorkTransferProjection {
    Long getId();

    @Value("#{target.getFrom().getId()}")
    Long getFromId();

    @Value("#{target.getTo().getId()}")
    Long getToId();

    @Value("#{target.getTo().getName()}")
    String getToName();

    @Value("#{target.getTo().fetchOrgFullName()}")
    String getToOrgFullName();
}
